﻿//Created by Action Script Viewer - http://www.buraks.com/asv
package Modules.malls.MarketUI.view {
    import flash.events.*;
    import flash.display.*;
    import Mechanics.GameMechanicInterfaces.*;
    import flash.utils.*;
    import org.aswing.*;
    import Classes.*;
    import Classes.util.*;
    import Display.*;
    import Display.aswingui.*;
    import Display.GridlistUI.model.*;
    import Modules.malls.ui.*;

    public class MallMysteryCellView extends MallCellView {

        protected var m_floorIndex:int;

        public function MallMysteryCellView(_arg1:IMechanicUser, _arg2:int, _arg3:int){
            super(_arg1, _arg2, _arg3, false);
            this.m_floorIndex = _arg3;
        }
        protected function get mysteryAsset():DisplayObject{
            return (m_assetDict["mystery_bus"]);
        }
        protected function get highlightCell():Boolean{
            var _local1:Array = (m_mechanicUser.getDataForMechanic("slots") as Array);
            var _local2 = (_local1.length >= ((this.m_floorIndex + 1) * MallCatalogUI.NUM_SLOTS_PER_FLOOR));
            var _local3:Boolean = (((m_mechanicUser is Mall)) && ((m_mechanicUser as Mall).hasMysteryBusinessInInventory(this.m_floorIndex)));
            return (((_local2) || (_local3)));
        }
        override public function makeAssets(_arg1:Dictionary):void{
            var _local2:DisplayObject = _arg1[DelayedAssetLoader.MARKET_ASSETS];
            m_assetDict["bg"] = (new (_local2["marketItem_reward"])() as DisplayObject);
            var _local3:DisplayObject = _arg1[DelayedAssetLoader.MALL_ASSETS];
            m_assetDict["mystery_bus"] = (new (_local3["mall_mystery_new"])() as DisplayObject);
        }
        override public function updateView(_arg1):void{
            if (this.highlightCell){
                m_bodyPanel.filters = [];
            } else {
                m_bodyPanel.filters = [ASwingHelper.makeDisabledFilter()];
            };
        }
        override protected function updateFooterPanel():void{
            m_footPanel.removeAll();
            var _local1:Number = TextFieldUtil.getLocaleFontSize(16, 14, null);
            var _local2:String = TextFieldUtil.formatSmallCapsString(ZLoc.t("Dialogs", "MallMysteryCell_footer"));
            var _local3:JTextField = ASwingHelper.makeTextField(_local2, EmbeddedArt.TITLE_FONT, _local1, EmbeddedArt.yellowTextColor);
            if (this.highlightCell){
                _local3.filters = EmbeddedArt.titleFilters;
            } else {
                _local3.filters = EmbeddedArt.titleFilters.concat(ASwingHelper.makeDisabledFilter());
            };
            m_footPanel.append(_local3);
        }
        override protected function initLayout():void{
            super.initLayout();
            ASwingHelper.setEasyBorder(m_panel, 0, 5, 0, 5);
        }
        override protected function createContentPlaceholder():DisplayObject{
            return (this.mysteryAsset);
        }
        override protected function onClick(_arg1:MouseEvent=null):void{
        }
        override protected function onRollOver(_arg1:MouseEvent=null):void{
            this.dispatchEvent(new ViewActionEvent("onDisplayMysteryCellTooltip"));
        }
        override protected function onRollOut(_arg1:MouseEvent=null):void{
            dispatchEvent(new Event("turnOffToolTip", true));
        }

    }
}//package Modules.malls.MarketUI.view 
